<?php
    $param_page     = !empty($this->param_page)?$this->param_page:PARAM_PAGE_NAME;
    $query          = !empty($this->query)?'?'.http_build_query($this->query):'';
?>
<?php if($this->pageCount > 1): ?>
<ul class="cp_paging">
    Page <?php echo $this->current ?> of <?php echo $this->pageCount?>:
<?php if( $this->current == $this->first):?>
    <li class="disabled">
          &lsaquo;&lsaquo; First
    </li>
<?php else: ?>
    <li>
        <a href="<?php echo $this->url(array('module' => 'contest', $param_page => 1)) ?><?php echo $query ?>" target="_parent">
          &lsaquo;&lsaquo; First
        </a>
    </li>
<?php endif;?>
<?php if( !empty($this->previous) ):?>
    <li>
        <a href="<?php echo $this->url(array('module' => 'contest', $param_page => $this->previous)) ?><?php echo $query ?>" target="_parent">
          &lsaquo;
        </a>
    </li>
<?php else:?>
    <li class="disabled">
          &lsaquo;
    </li>
<?php endif;?>
    <?php foreach ($this->pagesInRange as $page): ?>
        <?php if ($page == $this->current): ?>
            <li class="active">
        <?php else: ?>
            <li>
        <?php endif;?>
        <?php if ($page == $this->current): ?>
            <?php echo $page; ?>
        <?php else: ?>
            <a href="<?php echo $this->url(array('module' => 'contest', $param_page => $page)) ?><?php echo $query ?>" >
                <?php echo $page; ?>
            </a>
        <?php endif;?>
    </li>
    <?php endforeach; ?>
<?php if( !empty($this->next) ):?>
    <li>
        <a href="<?php echo $this->url(array('module' => 'contest', $param_page => $this->next)) ?><?php echo $query ?>" >
          &rsaquo;
        </a>
    </li>
<?php else:?>
    <li class="disabled">
        &rsaquo;
    </li>
<?php endif;?>
<?php if( $this->current == $this->last):?>
    <li class="disabled">
        Last &rsaquo;&rsaquo;
    </li>
<?php else:?>
    <li>
        <a href="<?php echo $this->url(array('module' => 'contest', $param_page => $this->pageCount)) ?><?php echo $query ?>">
          Last &rsaquo;&rsaquo;
        </a>
    </li>
<?php endif;?>
</ul>
<?php endif;?>